Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use namespaces #328

Merged
merged 4 commits into from
May 31, 2017
Merged

Use namespaces #328

merged 4 commits into from
May 31, 2017

Conversation

wjwwood
Copy link
Member

@wjwwood wjwwood commented May 26, 2017

Connects to ros2/rcl#137

Examples of it in use:

% talker -t /foo/3bar
libc++abi.dylib: terminating with uncaught exception of type rclcpp::exceptions::InvalidTopicNameError: Invalid topic name: topic name token must not start with a number:
  '/foo/3bar'
        ^

[1]    82558 abort      talker -t /foo/3bar

"full" topic name check (post expansion check):

% talker -t /foo/{ns}/bar
libc++abi.dylib: terminating with uncaught exception of type rclcpp::exceptions::InvalidTopicNameError: Invalid topic name: topic name must not contain repeated '/':
  '/foo///bar'
        ^

[1]    82579 abort      talker -t /foo/{ns}/bar

Services:

% add_two_ints_client -s foo/3bar
libc++abi.dylib: terminating with uncaught exception of type rclcpp::exceptions::InvalidServiceNameError: Invalid service name: topic name token must not start with a number:
  'foo/3bar'
       ^

[1]    82599 abort      add_two_ints_client -s foo/3bar
% add_two_ints_client -s foo/3bar
libc++abi.dylib: terminating with uncaught exception of type rclcpp::exceptions::InvalidServiceNameError: Invalid service name: topic name token must not start with a number:
  'foo/3bar'
       ^

[1]    82599 abort      add_two_ints_client -s foo/3bar

Node name (locally modified):

% talker
libc++abi.dylib: terminating with uncaught exception of type rclcpp::exceptions::InvalidNodeNameError: Invalid node name: node name must not contain characters other than alphanumerics or '_':
  'invalid_talker?'
                 ^

[1]    83140 abort      talker

Namespace (locally modified):

% talker
libc++abi.dylib: terminating with uncaught exception of type rclcpp::exceptions::InvalidNamespaceError: Invalid namespace: namespace must not contain characters other than alphanumerics, '_', or '/':
  '/invalid_ns?'
              ^

[1]    83509 abort      talker

(actual change to topic names in next commit)
for node names, namespaces, and topic/service names
@wjwwood wjwwood added enhancement New feature or request in progress Actively being worked on (Kanban column) labels May 26, 2017
@wjwwood wjwwood self-assigned this May 26, 2017
@wjwwood wjwwood added in review Waiting for review (Kanban column) and removed in progress Actively being worked on (Kanban column) labels May 27, 2017
// *INDENT-ON*
rcl_ret_t ret = rcl_send_request(get_client_handle(), request.get(), &sequence_number);
if (RCL_RET_OK != ret) {
rclcpp::exceptions::throw_from_rcl_error(ret);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why does this not get a prefix/suffix?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

See: 2ebf066

{
char * expanded_topic = nullptr;
rcl_allocator_t allocator = rcl_get_default_allocator();
rcutils_allocator_t rcutils_allocator = rcutils_get_default_allocator();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what is the diff between the two allocators?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nothing right now, but they are technically different. If we were to change the default allocator for rcl versus rcutils, then this difference would be good to have. If it were someone else's code I would not require them to do future proof their code in this way.

Since it already exists, I'll leave it as-is.

@wjwwood wjwwood merged commit b906768 into master May 31, 2017
@wjwwood wjwwood deleted the use_namespaces branch May 31, 2017 01:25
@wjwwood wjwwood removed the in review Waiting for review (Kanban column) label May 31, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants